<foreach name="data['config']" item="form" key="o_key">
<div class="form-item cf">
<label class="item-label">
    {$form.title|default=''}
    <present name="form.tip">
        <span class="check-tips">{$form.tip}</span>
    </present>
</label>
<switch name="form.type">

    <case value="radio">
    <div class="controls">
        <foreach name="form.options" item="opt" key="opt_k">
            <label class="radio">
                <input type="radio" name="config[{$o_key}]" value="{$opt_k}" <eq name="form.value" value="$opt_k"> checked</eq>>{$opt}
            </label>
        </foreach>
    </div>
</case>


<case value="water">
    <php>empty($form['value']) && $form['value']='./Addons/Water/water.png';</php>
    <div class="controls">
        <input type="file" id="upload_picture_{$o_key}">
        <input type="hidden" name="config[{$o_key}]" id="cover_id_{$o_key}" value="{$form.value}"/>
        <div class="upload-img-box">
            <notempty name="form['value']">
                <div class="upload-pre-item" >
                    <img src="{$form['value']}"  ondblclick="removePicture{$o_key}(this)"/>
                </div>
            </notempty>
        </div>
    </div>
    <script type="text/javascript">
        //上传图片
        /* 初始化上传插件 */
        $("#upload_picture_{$o_key}").uploadify({
            "height"          : 30,
            "swf"             : "__STATIC__/uploadify/uploadify.swf",
            "fileObjName"     : "download",
            "buttonText"      : "上传图片",
            "uploader"        : "{:addons_url('Water://File/uploadPicture',array('session_id'=>session_id()))}",
            "width"           : 120,
            'removeTimeout'   : 1,
            'fileTypeExts'    : '*.jpg; *.png; *.gif;',
            "onUploadSuccess" : uploadPicture{$o_key},
        'onFallback' : function() {
            alert('未检测到兼容版本的Flash.');
        }
        });

        function uploadPicture{$o_key}(file, data){
            var data = $.parseJSON(data);
            var src = '';
            if(data.status){
                src = data.url || '__ROOT__' + data.path
                $("#cover_id_{$o_key}").parent().find('.upload-img-box').html(
                        '<div class="upload-pre-item" val="' + data.id + '"><img src="__ROOT__' + src + '" ondblclick="removePicture{$o_key}(this)"/></div>'
                );
                $("#cover_id_{$o_key}").val(src);

            } else {
                updateAlert(data.info);
                setTimeout(function(){
                    $('#top-alert').find('button').click();
                    $(that).removeClass('disabled').prop('disabled',false);
                },1500);
            }
        }
        function removePicture{$o_key}(o){
            var p = $(o).parent().parent();
            $(o).parent().remove();
            setPictureIds{$o_key}();
        }

    </script>
</case>

    <case value="select">
        <div class="controls">
            <select name="config[{$o_key}]">
                <foreach name="form.options" item="opt" key="opt_k">
                    <option value="{$opt_k}" <eq name="form.value" value="$opt_k"> selected</eq>>{$opt}</option>
                </foreach>
            </select>
        </div>
    </case>

</switch>

</div>
</foreach>